<!DOCTYPE html>
<html>
    <head>
        <title>AGM客服会话关闭</title>
        <link rel="stylesheet" href="/static/weui.min.css">
        <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
        <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <style>
            .page, body{background-color: #fbf9fe}
            .page_title{color:#225fba}
            .hd{text-align:center}
            .weui_label{width:4em;}
            .bd{padding-bottom:30px;}
            .weui_cell_hd img{height: 40px;}
            .nav_right{position: absolute;right: 5px;width: 35px;top: 5px;}
            .weui_actionsheet_menu a .weui_actionsheet_cell{color:initial;border-top: 1px solid #d9d9d9;} 
        </style>
    </head>
    <body>
        <div id='wx_logo' style="display:none;"><img src="/static/images/wx_logo.jpg"/></div>
        <div class="hd">
            <h2 class="page_title">AGM客服会话关闭页面</h2> 
        </div>
        <div class="bd">
            <div class="weui_cells_title">当前会话中的用户</div>
            <div class="weui_cells weui_cells_form">
                {% for openid in openids %}
                <div class="weui_cell weui_cell_switch">
                    <div class="weui_cell_hd"><img src="{{ user_dict[openid]['headimgurl'] or '/static/images/getheadimg.png' }}"></div>
                    <div class="weui_cell_hd weui_cell_primary">{{ user_dict[openid]['nickname'] }}</div>
                    <div class="weui_cell_ft">
                        <a href="javascript:;" class="weui_btn weui_btn_mini weui_btn_warn closebtn" data_id="{{openid}}">关闭</a>
                    </div>
                </div>
                {% endfor %}               
            </div>
            <div class="weui_cells_tips">注意：点击关闭直接结束会话，用户的微信客户端弹出本次对话评价选项</div>
        </div>        
    </body>
    <script>
        $('.closebtn').click(function(){
            var parent = $(this).parents('.weui_cell');
            var openid = $(this).attr('data_id');
            $.post('?action=closekf&openid=' + openid, function(data){
                if(data=='success'){
                    hideIt(parent);
                }
            });
        })
        hideIt = function(element){
            element.animate(
                {'right': '150%'},
                300,
                function(){
                    element.remove();
                }
            )
        }
    </script>
<html>